package com.wish.g04.system.api.factory;

import com.wish.g04.common.core.domain.R;
import com.wish.g04.system.api.RemoteDictService;
import com.wish.g04.system.api.domain.DictData;
import feign.hystrix.FallbackFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 字典服务降级处理
 * 
 * @author tianyandong
 */
@Component
public class RemoteDictFallbackFactory implements FallbackFactory<RemoteDictService>
{
    private static final Logger log = LoggerFactory.getLogger(RemoteDictFallbackFactory.class);


    @Override
    public RemoteDictService create(Throwable throwable) {
        log.error("字典服务调用失败:{}", throwable.getMessage());
        return new RemoteDictService() {
            @Override
            public List<DictData> getDictDataByType(String dictType) {
                return null;
            }
        };
    }
}
